<!doctype html>
<html><%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.duapk.common.*,java.util.*,java.net.*" %>
<% SearchResult searchResult = (SearchResult)request.getAttribute("result"); List<Result> resultList = searchResult.getResultList();  %>
<head>
<meta name="keywords" content="百汇搜索,Android应用搜索,安卓搜索,搜索,安卓游戏,安卓软件,安卓工具,安卓图片,安卓阅读,安卓书籍" />
<meta name="description" content="百汇搜索,搜索引擎,Android应用搜索,安卓搜索,搜索,安卓游戏,安卓软件,安卓工具,安卓图片,安卓阅读,安卓书籍" />
<meta http-equiv=Content-Type content="text/html;charset=UTF-8">
<title><%=searchResult.getKeyword()%>-百汇搜索</title>
<style>
* {
	margin: 0;
	padding: 0;
}

body {
	margin: 7px 50px 12px 50px;
	font-family:Arial;font-size:12px;background:#fff;color:#464646; line-height:16px
}

a {
	color: blue;
	text-decoration: none;
}

#header {
	margin: 2px 10px 2px 10px;
	border: 1px #d3e2f9;
}

.logo {
	margin: 0px 15px 0px 15px;
	float: left;
}

#n {
	position: relative;
	margin-top: 20px;
	margin-bottom: 3px;
	zoom: 1;
	font: 14px verdana;
}

#n a {
	margin-right: 12px;
	margin-left: 12px;
}

#sf {
	width: 780px;
	text-align: left;
	position: relative;
	margin-left: 145px;
	margin-bottom: 2px;
}

#bottom_sf{
	width: 780px;
	text-align: left;
	position: relative;
	margin-left: 0px;
	margin-bottom: 2px;
}

#top {
	margin-top: 5px;
	margin-bottom: 8px;
	border: 1px #d3e2f9;
}

#content {
	border: 1px #d3e2f9;
}

#left {
	margin-left: 20px;
	width: 140px;
	font: 16px verdana;
	padding-right: 5px;
	float: left;
}

.adv {
	margin-left:530px;
}

#center {
	width: 720px;
	float: left;
	clear: none;
}

.type {
	border-bottom: solid #d3e2f9 1px;
	margin-bottom:5px;
}

.q {
	width: 630px;
	height: 1.45em;
	padding-top: 2px;
	font: 16px arial;
	margin-right: 0px;
}

.stb {
	width: 5.6em;
	height: 2.2em;
	font: 16px arial;
}

#right {
	width: 250px;
	border-left: solid #d3e2f9 1px;
	margin-left:5px;
	padding-left:5px;
	float: left;
	clear: right;
}

.type ul {
	list-style-type: none;
	margin-left: 0px;
	margin-bottom: 5px;
	
}

.type li {
	margin-bottom: 3px;
}

#main_content{
	border-left: solid #d3e2f9 1px;
}

.history ul{
	list-style-type: none;
	margin-left: 0px;
	margin-bottom: 3px;
}

.history li{
	margin-bottom: 3px;
	font-size: 10px;
}

.result_size{
	margin-left:12px;
}

.app{
	margin-left:10px;
	margin-bottom:10px;
}

.applogo{
	margin-left:5px;
	margin-right:5px;
	width: 48px;
	height: 48px;
}

.apptitle{
	font: 16px verdana;
}

.apptitle a:link{
	text-decoration: underline;
}

.appdesc{
	margin-top: 3px;
	margin-bottom: 3px;
	line-height: 160%
}

.otherinfo{
	color:#77c;
	line-height: 150%
}

.downlink{
	color:#77c;
	line-height: 150%
}

.appcotent{
	margin-left:10px;
	width:640px;
}

#center_bottom {
	margin: 10px 5px 10px 5px;
	clear:both;
}

#page{
	margin-bottom:20px;
	text-align:center;
	margin-top:20px;
	font:15px verdana;
	clear:right;
}

#page span{
	margin-left:7px;
	margin-right:7px;
}

#ft,#cp, #ft a {
	color: #7777cc;
	line-height: 21px;
	font:12px arial;
	text-align: center;
	margin-top:5px;
}

.detaillink{
	color: #0e774a;
}

.no_content{
	margin-left: 30px;
	line-height: 35px;
}

.typeselect, .typeselect a:link,.typeselect a:visited{
	background-color: #3366ff;
	color:white;
}

.versionselect, .versionselect a:link,.versionselect a:visited{
	color:black;
	font-weight: bold;
}

em,.apptitle a em{
	color:red;
	font-style: normal;
}

</style>
</head>
<body>
	<div id="header">
		<div class="logo">
			<a href="/index.htm"> <img src="/img/slogo.png" /> </a>
		</div>
		<div id=n>
			<a href="/clfs/game.htm">游戏</a> <a href="/clfs/stock.htm">股票</a> <a
				href="/clfs/software.htm">软件</a> <a href="/clfs/theme.htm">主题</a> <a
				href="/clfs/book.htm">图书</a> <a href="/clfs/image.htm">美图</a>
		</div>

		<form action=/s name=sf id="sf" method=get
			onsubmit="document.sf._ast.value=Math.round(new Date().getTime()/1000);">

			</span> <input name=q id="query" class=q size=47 maxlength=100 value="<%=searchResult.getKeyword()%>"
				autocomplete=off>
				<input type="hidden" name="v" value="all">
				<input type="hidden" name="start" value="all">
				<input type="hidden" name="size" value="all">
				<input type="hidden" name="f" value="">
				<input type="hidden" name="pubtime" value="all">
				<input type="hidden" name="p" value="1">
				<input type="hidden" name="s" value="10">
				<input type="hidden" name="t" value="all">
				<input type=submit class=stb value="百汇搜索"
				id="stb" onclick="if(this.form.query.value=='')return false">
		</form>

	</div>
	<div id="top">
	<%if(resultList!=null && resultList.size()>0){ %>
		<span class="result_size">找到约<%=searchResult.getTotalItem()%>个相关应用 </span>
	<%}else{%>
		<span class="result_size">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
	<%} %>	
		<span class=adv><a href=/adv/advanced.htm>高级搜索</a></span>
	</div>
	<div id="content">
		<div id="left">
			<div class="type">
			   <% String t = request.getParameter("t"); %>
				<ul>
					<li>所有结果</li>
					<li<% if("game".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=game&<%=searchResult.getParameters()%>&p=1">游戏</a></li>
					<li<% if("stock".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=stock&<%=searchResult.getParameters()%>&p=1">股票</a></li>
					<li<% if("software".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=software&<%=searchResult.getParameters()%>&p=1">软件</a></li>
				<!--  	<li<% if("theme".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=theme&<%=searchResult.getParameters()%>&p=1">主题</a></li>  -->
					<li<% if("book".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=book&<%=searchResult.getParameters()%>&p=1">图书</a></li>
					<li<% if("image".equals(t)){ %> class="typeselect" <%} %>><a href="/s?t=image&<%=searchResult.getParameters()%>&p=1">美图</a></li>
				</ul>
			</div>
			<div class="type">
			 <% String v = request.getParameter("v"); %>
				<ul>
					<li>所有版本</li>
					<li<% if("1.5".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=1.5&<%=searchResult.getParameters()%>&p=1">1.5</a></li>
					<li<% if("1.6".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=1.6&<%=searchResult.getParameters()%>&p=1">1.6</a></li>
					<li<% if("2.1".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=2.1&<%=searchResult.getParameters()%>&p=1">2.1</a></li>
					<li<% if("2.2".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=2.2&<%=searchResult.getParameters()%>&p=1">2.2</a></li>
					<li<% if("2.3".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=2.3&<%=searchResult.getParameters()%>&p=1">2.3</a></li>
					<li<% if("3.0".equals(v)){ %> class="versionselect" <%} %>><a href="/s?v=3.0&<%=searchResult.getParameters()%>&p=1">3.0</a></li>
				</ul>
			</div>
			<div class="history">
				<ul>
					<li>搜索历史</li>
					<div id="searchHistory">
					</div>
					<li>&nbsp;</li>
					<li><a href="javascript:clearCookie();">清除搜索历史</a></li>
				</ul>
				
			</div>
		</div>
		<div id="center">
		<div id="main_content">
		<% 	
			if(resultList!=null && resultList.size()>0) {
				int i = 0;
				for(Result result:resultList){
					i++;
		%>
			<div class="app">
				<table><tr>
					<td><img src="<%=result.getLogo()%>" class="applogo"/></td>
					<td>
						<div class="appcotent">
						<div class="apptitle"><a href="<%=result.getProxyDetailUrl()%>"><%=result.getTitle()%>[<%= result.getCategory()%>]</a></div>
						<div class="appdesc">&nbsp;&nbsp;&nbsp;&nbsp;<%= result.getDescription() %></div>
						<div class="otherinfo">文件大小:<%=result.getFileSizeStr()%> &nbsp;&nbsp;&nbsp;  版本:Android<%=result.getVersion()%><br/>
						发布时间:<%=result.getPubTimeStr()%>&nbsp;&nbsp;&nbsp;星级:<img src="/img/stars_<%=result.getStarInt()%>_0.png"/></div>
						<div class="downlink"><a href="<%=result.getDownloadUrl()%>">直接下载</a> - <a href="javascript:showQrDl(<%=i%>)">二维码下载</a>
						<% Result next = result.getNextResult(); if(next!=null){ %>  - <a href="javascript:showSameResult(<%=i%>)"><span id="sametitle<%=i%>">显示相似结果</span></a> <%} %>
						</div>
						<div class="detaillink"><%=result.getDetailUrl()%></div>						
					</td>
				</tr></table>
				<div id="qr<%=i%>" style="display:none">
					<img src="/qr?<%=result.getDownloadUrl()%>"/>
				</div>
			</div>
			<div id="sameresult<%=i%>" style="display:none">
			<% 
				if(next!=null){
					List<Result> listResult = new ArrayList<Result>();
					while(true){
						listResult.add(next);
						next = next.getNextResult();
						if(next==null){
							break;
						}
					}
				for(Result nextResult:listResult){	
			%>	
			 <div class="app">
				<table><tr>
					<td><img src="<%=nextResult.getLogo()%>" class="applogo"/></td>
					<td>
						<div class="appcotent">
						<div class="apptitle"><a href="<%=nextResult.getProxyDetailUrl()%>"><%=nextResult.getTitle()%>[<%= nextResult.getCategory()%>]</a></div>
						<div class="appdesc">&nbsp;&nbsp;&nbsp;&nbsp;<%= result.getDescription() %></div>
						<div class="otherinfo">文件大小:<%=nextResult.getFileSizeStr()%> &nbsp;&nbsp;&nbsp;  版本:Android<%=nextResult.getVersion()%><br/>
						发布时间:<%=nextResult.getPubTimeStr()%>&nbsp;&nbsp;&nbsp;星级:<img src="/img/stars_<%=nextResult.getStarInt()%>_0.png"/></div>
						<div class="downlink"><a href="<%=nextResult.getDownloadUrl()%>">直接下载</a> - <a href="javascript:showQrDl(<%=i*37+1%>)">二维码下载</a></div>
						<div class="detaillink"><%=nextResult.getDetailUrl()%></div>						
					</td>
				</tr></table>
				<div id="qr<%=i*37+1%>" style="display:none">
					<img src="/qr?<%=nextResult.getDownloadUrl()%>"/>
				</div>
			</div>
			<%}}%>	
			</div>
		<% }}else{%>
		<div class="no_content">
		<p>
		找不到和您的查询 "<%=searchResult.getKeyword()%>"相符的应用。
		</p>
		<p>建议：<p>
		<ul>
			<li>请尝试其他的搜索关键词</li>
		</ul>
		</div>
		<%} %>
		</div>
		
		<div id="page">
			<% if(searchResult.isShowUpLink()){ %>
				<span><a href="/s?<%=searchResult.getParameters()%>&p=<%=searchResult.getPageID()-1%>">上一页</a></span>
			<%}%>		
			<% 
				for(int i=1;i<=searchResult.getEnd();i++){
				if(searchResult.getPageID()==i){
			%>
					<span>[<%=i%>]</span>
			<% 	 
				}else{
			%>
				<span><a href="/s?<%=searchResult.getParameters()%>&p=<%=i%>"><%=i%></a></span>
			<%}} %>
			<% if(searchResult.isShowNextLink()){ %>
				<span><a href="/s?<%=searchResult.getParameters()%>&p=<%=searchResult.getPageID()+1%>">下一页</a></span>
			<%}%>			
		</div>
		
		<div id="center_bottom">
			<form action=/s name=sf id="bottom_sf" method=get
			onsubmit="document.sf._ast.value=Math.round(new Date().getTime()/1000);">
			</span> <input name=q id="query" class=q size=47 maxlength=100 value="<%=searchResult.getKeyword()%>"
				autocomplete=off>
				<input type="hidden" name="v" value="all">
				<input type="hidden" name="start" value="all">
				<input type="hidden" name="size" value="all">
				<input type="hidden" name="f" value="">
				<input type="hidden" name="pubtime" value="all">
				<input type="hidden" name="p" value="1">
				<input type="hidden" name="s" value="10">
				<input type="hidden" name="t" value="all">
				<input type=submit class=stb value="百汇搜索"
				id="stb" onclick="if(this.form.query.value=='')return false">
			</form>
			<div id=ft>
				<a href="/index.htm">返回首页</a>&nbsp;-&nbsp;<a href="/docs/about.htm">关于我们</a>&nbsp;-&nbsp;<a href=/docs/terms.htm>免责声明</a>&nbsp;-&nbsp;<a href=/docs/help.htm>使用帮助</a>
			</div>
			<div id="cp">&copy; 2011 百汇搜索</div><div style="display: none"><script src="http://s21.cnzz.com/stat.php?id=2981572&web_id=2981572&show=pic1" language="JavaScript"></script></div>
		</div>
		</div>
		<div id="right"></div>
	</div>
</body>
</html>
<script language="javascript">
function getCookie(name) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
		if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
			return null;
		}
		if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ';', len );
		if ( end == -1 ) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ) );
}
function setCookie( name, value, expires, path /*, domain, secure*/ ) {
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires ) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name+'='+escape( value ) +
        ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
        ( ( path ) ? ';path=' + path : '' );
        //( ( domain ) ? ';domain=' + domain : '' ) +
        //( ( secure ) ? ';secure' : '' );
}
function deleteCookie( name, path, domain ) {
    if ( getCookie( name ) ) document.cookie = name + '=' +
            ( ( path ) ? ';path=' + path : '') +
            ( ( domain ) ? ';domain=' + domain : '' ) +
            ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
//搜索历史记录处理
	var prefix = "_s_keys_";
	var max = 10;
	var key = "<%=searchResult.getKeyword()%>";
	for(var i=0;i<max;i++){
		var value = getCookie(prefix+i);
		if(value==encodeURI(key)){
			break;
		}
		setCookie(prefix+i,encodeURI(key),100,"/");
		if(value==null){
			break;
		}
		key = decodeURI(value);
	}
	var tt = "";
	for(var i=0;i<max;i++){
		var value = getCookie(prefix+i);
		if(value==null){
			continue;
		}
		tt = tt +  "<li><a href='/s?q=" + decodeURI(value) + "&<%=searchResult.getParameters()%>&p=1'>" + decodeURI(value) + "</a></li>";
	}
	document.getElementById("searchHistory").innerHTML = tt;
	
function clearCookie(){
	for(var i=0;i<max;i++){
		var key = prefix + i;
		deleteCookie(key,"/","");
	}	
	document.getElementById("searchHistory").innerHTML = "";
}
function showQrDl(i){
	var name = "qr" + i;
	if(document.getElementById(name).style.display=='block'){
		document.getElementById(name).style.display='none';
	}else{
		document.getElementById(name).style.display='block';
	}
	document.getElementById(name).style.float='right';
	<% 
		if(resultList!=null && resultList.size()>0){
	%>
		for(var j=1;j<=<%=resultList.size()%>;j++){
			if(i!=j){
				document.getElementById("qr" + j).style.display='none';
			}
		}
	<%}%>
}
function showSameResult(i){
	var name = "sameresult"+i;
	if(document.getElementById(name).style.display=='block'){
		document.getElementById(name).style.display='none';
		document.getElementById("sametitle"+i).innerHTML = "显示相似结果";
	}else{
		document.getElementById(name).style.display='block';
		document.getElementById("sametitle"+i).innerHTML = "隐藏相似结果";
	}
}
</script>